//package com.openvas.core.gas.rest;
//
//import cn.afterturn.easypoi.excel.ExcelExportUtil;
//import cn.afterturn.easypoi.excel.entity.ExportParams;
//import com.coconet.gas.biz.ReportBiz;
//import com.coconet.gas.vo.dw.Report;
//import io.swagger.annotations.ApiOperation;
//import org.apache.poi.ss.usermodel.Workbook;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.annotation.Resource;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//import java.io.OutputStream;
//import java.util.Collections;
//import java.util.List;
//
//@RestController
//public class ReportRest {
//    @Resource
//    private ReportBiz reportBiz;
//
//    @ApiOperation(value = "扫描报告EXCEL导出", httpMethod = "POST")
//    @PostMapping(value = "/export")
//    public void getCityByProvinceId(HttpServletResponse res,@RequestBody Report report) {
//        List<Report> reportList = reportBiz.selectList(report);
//        Collections.sort(reportList, (p1, p2) -> Double.valueOf(p2.getSeverity()).compareTo(Double.valueOf(p1.getSeverity())));
//        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("扫描报告", "报告"), Report.class, reportList);
//        res.setHeader("Content-Disposition", "attachment;filename=" + "report.xls");
//        res.setContentType("application/octet-stream");
//        res.setCharacterEncoding("UTF-8");
//        OutputStream os = null;
//        try {
//            os = res.getOutputStream();
//            workbook.write(os);
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
//    }
//
//}
